import { ApiProperty } from "@nestjs/swagger";
import { IsEmail, IsNotEmpty, IsString, MinLength } from "class-validator";

export class RegisterDto {
    @IsString()
    @IsNotEmpty({ message: "用户名不能为空" })
    @MinLength(1, { message: "用户名至少1个字符" })
    @ApiProperty({
        description: "用户名",
        example: "JohnDoe",
        required: true
    })
    username: string;

    @IsEmail({}, { message: "邮箱格式不正确" })
    @IsNotEmpty({ message: "邮箱不能为空" })
    @ApiProperty({
        description: "邮箱地址",
        example: "john.doe@example.com",
        required: true
    })
    email: string;

    @IsString()
    @IsNotEmpty({ message: "密码不能为空" })
    @MinLength(6, { message: "密码至少6个字符" })
    @ApiProperty({
        description: "密码",
        example: "password123",
        required: true
    })
    password: string;
}
